##########
#Playing to the Gallery: Emotive Rhetoric in Parliaments
#Moritz Osnabruegge, Sara B. Hobolt, Toni Rodon
#This script produces Figure A1
##########


rm(list=ls())

library("data.table")
library("ggplot2")
library("tidyverse")
library("scales")

#Specify the path here
setwd("")

data = fread("uk_data.csv", encoding="UTF-8", select=c('emotive_rhetoric'))


#Figure A2: The distribution of emotive rhetoric
p = ggplot(data, aes(x=emotive_rhetoric)) + 
    geom_histogram(aes(y=..density..), colour="black", fill="white", bins=50) +
    geom_rug() +
    geom_vline(xintercept=mean(data$emotive_rhetoric), colour="red", linetype="dashed") +
    labs(title="",x="", y="Density") +
    scale_y_continuous(labels=percent_format()) +
    theme(text=element_text(size=20)) 

pdf("figure_a2.pdf",width=15,height=8)
print(p)
dev.off()
